/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.loveprog.service;

import br.com.loveprog.dao.DaoGenerico;
import br.com.loveprog.modelo.Usuario;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.Query;
import javax.persistence.EntityManager;

/**
 *
 * @author Leandro
 */
public class UsuarioService {

    private DaoGenerico<Usuario, Integer> usuarioDao;
    protected EntityManager em;
    
    public Usuario validarUsuarioLogin(String login, String senha){
         Query query = (Query) em.createNamedQuery("buscarPorLoginESenha");
         Map<String, Object> params = new HashMap<String,Object>();
         params.put("login", login);
         params.put("senha", senha);
         return usuarioDao.pesqParam(query , params);
    }
}
